package com.gzc.pm.logic
{
	import cn.skyclass.business.SessionManager;
	import cn.skyclass.net.BaseLoader;
	
	import com.gzc.pm.bean.EquipmentBean;
	import com.gzc.pm.dao.CollectionDao;
	import com.gzc.pm.util.MyUtil;
	import com.gzc.pm.util.PopUpUtil;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.events.ResultEvent;
	
	public class CollectionsLoader extends BaseLoader
	{
		public function CollectionsLoader(procId:int, startDate:Date, endDate:Date=null)
		{
			_procId = procId;
			_startDate = startDate;
			_endDate = endDate;
		}
		
		private var _procId:int;//工序ID
		private var _startDate:Date;
		private var _endDate:Date;
		public var equcons:ArrayCollection;//某工序中，设备的检测项配置信息
		
		override protected function doLoad():void{
			var procEquData:ProcEquLoader = SessionManager.current.getAttribute('procEquData') as ProcEquLoader;
//			var equList:ArrayCollection = procEquData.procEquDict[_procId] as ArrayCollection;
//			
//			var equCodesStr:String = "";
//			for each(var equ:EquipmentBean in equList){
//				equCodesStr += "'"+equ.equCode+"',";
//				//设备下的配置信息
//				var equconList:ArrayCollection = procEquData.equconDict[equ.equId] as ArrayCollection;
//				//设定同一工序下，所有设备的配置信息相同。取一种设备的配置信息，作为该工序下检测项配置信息
//				if(equconList && equconList.length>0) equcons = equconList;
//			}
//			equCodesStr += "'-1'";
//			
//			var sDateStr:String = MyUtil.date2StringWithoutHMS(_startDate, true);
//			var eDateStr:String = _endDate ? MyUtil.date2StringWithoutHMS(_endDate, false) : "30001231235959";
//			
//			var dao:CollectionDao = new CollectionDao();
//			dao.getInEquCodes(equCodesStr, sDateStr, eDateStr, _onCollectionsLoaded);
		}
		
		private function _onCollectionsLoaded(e:ResultEvent):void{
			resultList = e.result as ArrayCollection;//检测项列表
			
			dispatchLoadedEvent();
		}
		
	}
}